#pragma once
#include <QObject>
#include <QPixmap>
#include <QCache>
#include <QNetworkAccessManager>
#include <QNetworkDiskCache>

class TileLoader : public QObject {
    Q_OBJECT
public:
    explicit TileLoader(const QString &rootPath, QObject *parent = nullptr);
    QPixmap getTile(int z, int x, int y);

private:
    QString m_root;
    QCache<quint64, QPixmap> m_memCache{128};        // 128张
    QNetworkAccessManager m_net;
    QNetworkDiskCache m_diskCache;
};
